package com.aaa.service.scl.impl;

import com.aaa.entity.MyPage;
import com.aaa.service.scl.SclPlaneService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.aaa.entity.MyPage;
import com.aaa.entity.scl.SclPlane;
import com.aaa.service.scl.SclPlaneService;
import com.aaa.dao.scl.SclPlaneDao;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (SclPlane)表服务实现类
 *
 * @author makejava
 * @since 2022-10-27 19:11:05
 */
@Service
public class SclPlaneServiceImpl implements SclPlaneService {
   @Autowired
   private SclPlaneDao sclPlaneDao;

   /**
    * 查询所有计划
    * @param myPage
    * @return
    */
   @Override
   public PageInfo queryAll(MyPage myPage) {
      PageHelper.startPage(myPage.getPage(),myPage.getLimit());
      return new PageInfo(sclPlaneDao.selectAllData());
   }

   @Override
   public boolean selectPlane(SclPlane plane) {
      List<SclPlane> select = sclPlaneDao.select(plane);
      return select.size()==0;
   }

   /**
    * 添加计划
    * @param plane
    * @return
    */
   @Override
   public boolean insertPlane(SclPlane plane) {
      return sclPlaneDao.insert(plane)>0;
   }

   /**
    *查询邀请码
    * @param tFpaPlane
    * @return
    */
   @Override
   public SclPlane queryByQyCode(SclPlane tFpaPlane) {

      SclPlane sclPlane1 = sclPlaneDao.selectOne(tFpaPlane);

      return sclPlane1;
   }
}

